package cn.iocoder.ny.module.mall.mapper;

import cn.iocoder.ny.module.mall.controller.admin.order.vo.MallOrderVo;

import cn.iocoder.ny.module.mall.controller.admin.product.vo.MallProductPageVo;
import cn.iocoder.ny.module.mall.domain.MallBanner;
import cn.iocoder.ny.module.mall.domain.MallBannerPageVo;
import cn.iocoder.ny.module.mall.domain.MallOrder;
import cn.iocoder.ny.module.mall.domain.vo.MallProductVo;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelPageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsChannelDO;
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@InterceptorIgnore(tenantLine = "true")
@Mapper
public interface MallOrderMapper extends BaseMapperX<MallOrder> {

     default PageResult<MallOrder> selectPage(MallOrderVo mallOrderVo) {
        return selectPage(mallOrderVo,new LambdaQueryWrapperX<MallOrder>()
                .eqIfPresent( MallOrder::getTenantId,
                        mallOrderVo.getTenantId()));
    }

    //虽然mapper接口对应的 mapper实现
    //PageResult<HashMap> selectPage01(MallOrderVo mallOrderVo)

    //IPage<MallProductVo> queryMallProductList(IPage<MallProductVo> page, @Param("reqVO") MallProductPageVo mallProductListDTO);

    //两个VO是连表吗
    //IPage<HashMap> queryOrders(IPage<MallOrderVo> page, @Param("reqVO") MallProductPageVo mallProductListDTO);

    //todo1 连表查个hashmap出来
    //先返回list

    //todo 测试1 注解
    //自定义sql的的page呢
    @Select("SELECT * FROM user WHERE name LIKE CONCAT('%', #{name}, '%')")
    List<MallOrder> selectByNameSql (String name);

    //todo 测试2 xml
    //getMallOrderPageMap
    PageResult<HashMap<String,Object>> getMallOrderPageMapPR(MallOrderVo mallOrderVo);


    //todo 测试3 xml   带分页的话 入参能不能map
    //getMallOrderPageMap
    List<HashMap<String,Object>> getMallOrderList(MallOrderVo mallOrderVo);

    //分页入参 肯定是分页出参
    IPage<HashMap<String,Object>> selectPageByMap(@Param("page") Page<HashMap<String, Object>> page, @Param("params") HashMap<String, Object> params);

    //订单详情 selectMapByMap
    HashMap<String,Object> selectMapByMap(@Param("params") HashMap<String, Object> params);

    BigDecimal querySaleTotal(@Param("tenantId") Long tenantId);

    List<Map<String, Object>> selectMonthSaleTotal(Long tenantId);
    //订单详情连sys_user
    HashMap<String,Object> findVeriUser(@Param("params") HashMap<String, Object> params);
}